delete all fields that start with mongo

89

delete all fields that start with mongo -

db.teamList.find().forEach(
    function(document) {
        for(var k in document) {
            if (k.startsWith('team')) {
                delete document[k];
            }
        }
        db.teamList.save(document);
    }
);

Comments

Submit
0 Comments